package com.magicmovie.web.service;

import com.magicmovie.entity.Dictionary;
import com.magicmovie.utils.QueryFilters;
import com.magicmovie.utils.data.PageModel;
import com.magicmovie.web.service.impl.DictionaryServiceImpl;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@FeignClient(name = "service", fallback = DictionaryServiceImpl.class)
public interface DictionaryService {

    @RequestMapping(value = "/dictionary/findByKeyNo", method = RequestMethod.GET)
    List<Map<String, Object>> findByKeyNo(@RequestParam("keyNo") String keyNo);

    /**
     * 根据条件查询
     *
     * @param params 属性列表，过滤存在的属性值
     */
    @RequestMapping(value = "/dictionary/queryByParams", method = RequestMethod.POST)
    List<Dictionary> queryByParams(@RequestBody Map<String, Object> params);


    @RequestMapping(value = "/dictionary/getByFilter", method = RequestMethod.POST)
    PageModel getByFilter(@RequestBody QueryFilters filters);

    @RequestMapping(value = "/dictionary/update", method = RequestMethod.POST)
    void update(@RequestBody Dictionary dictionary);

    @RequestMapping(value = "/dictionary/insert", method = RequestMethod.POST)
    void insert(@RequestBody Dictionary dictionary);

    @RequestMapping(value = "/dictionary/delete", method = RequestMethod.POST)
    void delete(@RequestParam("id") Integer id);
}
